hfHist | R Documentation |
The function to produce a histogram for the given data values.
hfHist(what = NULL, x = NULL, freq = FALSE, bin.number = NULL, bin.width = NULL, col = "lightblue", border = "black", kde = TRUE, kde.bandwidth = 30, ...)
what |
the variable name; see Details |
x |
numeric; a vector of data to be plotted |
freq |
logical; if TRUE, the histogram is a representation of frequencies, otherwise probability densities are plotted |
bin.number |
integer, approximate number of bins per histogram |
bin.width |
integer, width for each of the bins |
col |
colour to fill the bars |
border |
colour of the border around the bars |
kde |
logical; should be the kernel density estimate (KDE) curve shown? |
kde.bandwidth |
numeric; KDE bandwidth. |
... |
further parameters to the function hist |
This function produces a standard histogram of univariate data with equi-spaced bins.
The number or width of individual bins can be specified using the
arguments bin.number
and bin.width
, respectively.
Moreover, optional arguments to the underlying function hist
can be supplied,
directly (col
or border
) or via the ...
parameter.
In particular, the argument breaks
provides a rather
versatile way of specifying the number/width of individual bins.
If desired (col = TRUE
and freq = FALSE
), a curve portraying the kernel density
estimate (KDE) is also drawn using the function density
. The smoothness of this
curve can be controlled by the parameter kde.bandwidth
, with the
'convenient compromise'
σ = 30
(Vermeesch & Garzanti 2015, Andersen et al. 2018)
set as a default value. In general, the higher is this value, the smoother curve results.
The variables to choose from are:
Menu item | Explanation |
Age (Ma) | U–Pb ages |
176Hf/177Hfi | Initial Hf isotopic ratios |
EpsHfi | Initial ε(Hf) values |
HfTCHUR.1stg | Single-stage CHUR Hf model ages |
HfTDM.1stg | Single-stage DM Hf model ages |
HfTDM.2stg | Two-stage DM Hf model ages |
These can be specified also upon the function call, as the parameter
'what
'.
The possibilities are 'Age (Ma)'
, '176Hf/177Hfi'
, 'EpsHfi'
,
'HfTCHUR.1stg'
, 'HfTDM.1stg'
or 'HfTDM.2stg'
.
Frequency histogram with superimposed KDE curve (bin.width = 50
,
kde.bandwidth = 30
) for detrital zircons from metavolcanic-sedimentary basement
of the Western Carpathians (data of Soejono et al. 2024)
An object of class 'histogram', a list returned by the function hist.
This is merely just an interface to the standard R functions hist and density.
Implemented by Vojtěch Janoušek, vojtech.janousek@geology.cz.
Andersen T, Kristoffersen M, Elburg MA (2018) Visualizing, interpreting and comparing detrital zircon age and Hf isotope data in basin analysis – a graphical approach. Basin Res 30:132–147 doi: 10.1111/bre.12245
Soejono I, Collett S, Kohút M, Janoušek V, Schulmann K, Bukovská Z, Novotná N, Zelinková T, Míková J, Hora JM, Veselovský F (2024) Paleogeography of the Gondwana passive margin fragments involved in the Variscan and Alpine collisions: perspectives from metavolcanic-sedimentary basement of the Western Carpathians. Earth Sci Rev 253: 104763 doi: 10.1016/j.earscirev.2024.104763
Vermeesch P, Garzanti E (2015) Making geological sense of 'Big Data' in sedimentary provenance analysis. Chem Geol 409:20–27 doi: 10.1016/j.chemgeo.2015.05.004
hist, density, hfBoxplot, hfStripplot, hfViolinplot
sampleDataset("tatric_Hf") hfHist("176Hf/177Hfi", breaks = 10) hfHist("Age (Ma)", bin.number = 20, col = "khaki") hfHist("Age (Ma)", bin.width = 100, freq = TRUE, kde = FALSE) hfHist("Age (Ma)", bin.width = 50, freq = FALSE, kde = TRUE, kde.bandwidth = 50)